import request from '@/utils/request'

// 查询设备保养计划列表
export function listMaintain(query) {
  return request({
    url: '/TMaintenanceSchedule/TMaintenanceSchedule/list',
    method: 'get',
    params: query
  })
}

// 保养列表子菜单查询
export function listMaintainChild(query) {
  return request({
    url: '/TMaintenanceScheduleDevice/TMaintenanceScheduleDevice/listdevice/' + query.id,
    method: 'get',
    params: query
  })
}

// 保养计划提交
export function submitMaintain(data) {
  return request({
    url: '/TMaintenanceSchedule/TMaintenanceSchedule/submit',
    method: 'post',
    data
  })
}

// 保养计划列表
export function getMaintainNumber() {
  return request({
    url: '/TMaintenanceSchedule/TMaintenanceSchedule/scheduleNumber',
    method: 'get'
  })
}

// 新增保养计划获取设备列表
export function getMaintainEquipmentList(query) {
  return request({
    url: '/TMaintenanceSchedule/TMaintenanceSchedule/devicelist',
    method: 'get',
    params: query
  })
}

// 查询设备保养计划详细
export function getMaintain(id) {
  return request({
    url: '/Maintain/Maintain/' + id,
    method: 'get'
  })
}

// 新增设备保养计划
export function addMaintain(data) {
  return request({
    url: '/TMaintenanceSchedule/TMaintenanceSchedule/addPlan',
    method: 'post',
    data: data
  })
}

// 修改设备保养计划
export function updateMaintain(data) {
  return request({
    url: '/Maintain/Maintain',
    method: 'put',
    data: data
  })
}

// 删除设备保养计划父级
export function delMaintain(id) {
  return request({
    url: '/TMaintenanceSchedule/TMaintenanceSchedule/' + id,
    method: 'delete'
  })
}

// 删除设备保养计划子级
export function delMaintainChild(id) {
  return request({
    url: '/TMaintenanceScheduleDevice/TMaintenanceScheduleDevice/' + id,
    method: 'delete'
  })
}

// 获取设备保养计划日历
export function getRuleMonth(id) {
  return request({
    url: '/TMaintenanceScheduleDevicePlan/TMaintenanceScheduleDevicePlan/calendar/' + id,
    method: 'get'
  })
}

// 修改保养计划（日历）
export function submitMaintainChange(data) {
  return request({
    url: '/TMaintenanceScheduleDevicePlan/TMaintenanceScheduleDevicePlan/editplan',
    method: 'post',
    data: data
  })
}

// 审批设备保养计划
export function maintainApprove(data) {
  return request({
    url: '/TMaintenanceSchedule/TMaintenanceSchedule/approve',
    method: 'post',
    data: data
  })
}

// 复制保养计划
export function copyMaintain(data) {
  return request({
    url: '/TMaintenanceSchedule/TMaintenanceSchedule/copyPlan',
    method: 'post',
    data
  })
}
